﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAO;
using DataAccess;
namespace BUL
{
    public class LoginBUL
    {
        ConnectDatabase cd = new ConnectDatabase();
        public Boolean checkLogin(String user, String pass) {
            String sql = "select * from login where user ='"+user+"' and pass = '"+pass+"'";
            if (cd.ExcuteQuery(sql).Rows.Count != 0) {
                return true;
            }
            return false;
        }
        public String getIdStaff(String user) {
            String sql = "select idStaff from login where user ='" + user + "'";
            return cd.ExcuteQuery(sql).Rows[0][0].ToString();
        }
        public String getPosition(String user) {
            String sql = "select staff.position from login,staff where login.idStaff=staff.idStaff and user ='" + user + "'";
            return cd.ExcuteQuery(sql).Rows[0][0].ToString();
        }
    }
}
